# -*- mode: snippet -*-
# name: basepng
# key: basepng
# --
#+NAME: basepng
#+begin_src emacs-lisp :exports none :var filename=""
  (defun tob64 (filename)
    (base64-encode-string
     (with-temp-buffer
       (insert-file-contents filename)
       (buffer-string))))

  (format "<img src=\\"data:image/png;base64,%s\\">" (tob64 (substring filename 7 -2)))
#+end_src
